pairData <- read.csv(stringsAsFactors = F,
                   file = "./QualtricsPairComparisonSparse-nofraud.csv")

statements <- read.csv("./selectedStatementsPunctuationFixed-balanced.csv", header=TRUE, stringsAsFactors=FALSE)

drop.statements <- statements$textid[statements$keep==0]

pairData <- pairData[!(pairData$statementID1 %in% drop.statements),]
pairData <- pairData[!(pairData$statementID2 %in% drop.statements),]

for (i in 1:nrow(statements)){
    oldID <- statements$textid[i]
    newID <- statements$textidfinal[i]
    pairData$statementID1[pairData$statementID1 == oldID] <- newID
    pairData$statementID2[pairData$statementID2 == oldID] <- newID
    pairData$choice[pairData$choice == oldID] <- newID
}

save(pairData, file="pairData.Rda")

